package controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import model.Envelope;
import client.CcrmApp;
import view.AnalyzeGui;
/**
 * analyze customers
 * @author liran 
 *
 */
public class AnalyzeController extends AbstractTransfer {
	/**
	 * go to marketing panel
	 */
	private  MarketingController backconn = null;
	
	private AnalyzeController currconn = null;
	
	private AnalyzeGui CurrGui = null;
	/**
	 * constructor
	 * @param b->MarketingController
	 * @param g->AnalyzeGui
	 */
	public AnalyzeController(MarketingController b,AnalyzeGui g ) {
		// TODO Auto-generated constructor stub
		currconn = this;
		CurrGui = g;
		backconn = b;
		
		CurrGui.AddbackMAc(new BackMenu());
		CurrGui.AddGenerateAC(new AnalyzeG());
	}
	
	/**
	 * back to menu
	 * @author liran
	 *
	 */
	class BackMenu implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			CurrGui.dispose();
			backconn.getMarkGui().setVisible(true);
		}
		
	}
	/**
	 * Active campaign 
	 * @author liran
	 *
	 */
	class AnalyzeG implements ActionListener{

		@Override
		public void actionPerformed(ActionEvent e) {
			// TODO Auto-generated method stub
			CcrmApp.clien.setCurrObj(currconn);
			String cmp = "";
			Envelope ev =  new Envelope((String)cmp,"analyze now");
			sendToServer(ev);	
		}
	}
	
	
	

}
